void main() {
  List list = ["香蕉", "苹果", "橘子"];

  for (int i = 0; i < list.length; i++) {
    print(list[i]);
  }

  list.forEach((element) {
    print(element);
  });

  for (var element in list) {
    print(element);
  }

  //map用于改变list的值
  List list1 = [1, 3, 5, 7, 9];
  var newList = list1.map((value) {
    return value * 2;
  });

  print(newList.toList());

  //where 选择合适的值返回
  newList = list1.where((element) {
    return element > 5;
  });
  print(newList.toList());

  //any 如果任意一个值符合条件就返回true
  var f = list1.any((element) {
    return element > 4;
  });
  print(f);

  //every 所有值符合条件才会返回true
  var f1 = list1.every((element) {
    return element > 4;
  });
  print(f1);
}
